#!/usr/local/bin/thrift 
# thrift --gen java -out src/main/java src/main/resources/thriftgen/gzlife-oauth.thrift
# thrift --gen py -out ./ gzlife-oauth.thrift
# thrift --gen go -out ./ gzlife-oauth.thrift

namespace java com.paas.demo.thrift


/* ---------------------------------------------------------------------------------
 *                            data structures
 ----------------------------------------------------------------------------------- */

struct OAuthApp {
    1: optional string id,
    2: optional string name,
    3: optional i64 userId,
    4: optional string secret,
    5: optional string description,
    6: optional string redirectUri,
    7: optional string site,
    8: optional i32 level,
    9: optional i16 status, // forbidden
    10: optional i64 createdAt,
}

// index resourceOwnerUserId,appId,created_at
// index token unique
// index refreshToken unique

/* ---------------------------------------------------------------------------------
 *                            Exceptions
 ----------------------------------------------------------------------------------- */

exception OAuthException
{
  1:i32 code,
  2:string msg
}

/* ---------------------------------------------------------------------------------
 *                            Services
 ----------------------------------------------------------------------------------- */
 service OAuthProviderService {
     OAuthApp registerApp(1: OAuthApp app),
     OAuthApp getAppById(1:string id),
 }
